package com.in.mobilerechargedth.adapter;


import java.util.List;

import com.in.mobilerechargedth.R;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import android.widget.BaseAdapter;
import android.widget.TextView;

public class SecondScreenListViewAdapter extends BaseAdapter {

    private Context context;
    private List<String> items;
    private LayoutInflater mInflater;

    public SecondScreenListViewAdapter(Context context, List<String> items) {
        // TODO Auto-generated constructor stub
        super();

        this.context = context;
        this.items = items;
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return items.size();
    }


    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View v, ViewGroup parent) {
        // TODO Auto-generated method stub
        ViewHolder viewHolder = null;

        if (v == null) {
            v = mInflater.inflate(R.layout.adapter_item_first_screen, null);
            viewHolder = new ViewHolder();
            viewHolder.action_name = (TextView) v.findViewById(R.id.txtOperatorName);

            v.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) v.getTag();
        }

        viewHolder.action_name.setText(items.get(position));

        return v;
    }


    @Override
    public Object getItem(int arg0) {
        // TODO Auto-generated method stub
        return null;
    }

    private class ViewHolder {
        TextView action_name;
    }
}
